package threewings;

/**
 * Handles chunks?
 *
 * @author Tyler Whitehouse.
 *         Created Oct 21, 2013.
 */
public class ChunkLoader implements Runnable{

	private Chunk chunk;
	private float sx, sz, ex, ez, step;
	private boolean loaded = false;
	
	/**
	 * 
	 * @param sx
	 * @param sz
	 * @param ex
	 * @param ez
	 * @param step
	 */
	public ChunkLoader(float sx, float sz, float ex, float ez, float step) {
		this.chunk = null;
		this.sx = sx;
		this.sz = sz;
		this.ex = ex;
		this.ez = ez;
		this.step = step;
	}
	
	@Override
	public void run() {
		this.chunk = new Chunk(this.sx, this.sz, this.ex, this.ez, this.step);
		this.loaded = true;
	}
	
	/**
	 * Gets the branchgroup this is attached to
	 *
	 * @return the branchgroup
	 */
	public Chunk getChunk(){
		return this.chunk;
	}
	
	/**
	 * Check whether the chunk has been loaded or not
	 * @return
	 */
	public Boolean isLoaded(){
		return this.loaded;
	}
}
